package com.winkyle.woodenfish.bindingadapter;

import android.databinding.BindingAdapter;
import android.graphics.drawable.Drawable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;

/**
 * @author winkyle
 * @date 2018/06/17
 * @description  图片加载 dataBinding适配
 */

public class ImageLoad {

    //通过url加载图片
    @BindingAdapter({"imageUrl","error"})
    public static void loadImageFromUrl(ImageView imageView, String url, Drawable drawable){
        //Glide本身就自带将图处理成圆形及高糊毛玻璃等型
        Glide.with(imageView.getContext())
                .load(url)
                .error(drawable)
                .into(imageView);
    }
}

